<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Vue.js 获取DOM元素</title>
        
        <script src="../../../js/vue.js"></script>
    </head>
    <body>
        <div id="app">
            <input ref="myInput" type="text" />
            <button @click="showInput">显示输入框内容</button>
        </div>
        
        <script>
            new Vue({
                el: '#app',
                methods: {
                    showInput() {
                        alert(this.$refs.myInput.value); // 获取输入框的值
                    }
                }
            });
        </script>
    </body>
</html>